/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.com.ces4.produccion.client.lineaproduccion.data;

import co.com.ces4.produccion.jpa.entities.ArticuloLinea;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;

/**
 *
 * @author Sebastian
 */
public class ArticuloLineaRecord extends ListGridRecord {

    public ArticuloLineaRecord(ArticuloLinea articuloLinea) {
        if (articuloLinea.getArticulo() != null) {
            setAttribute(ArticuloLineaDS.CODIGOARTICULO, articuloLinea.getArticulo().getDsid());
            setAttribute(ArticuloLineaDS.DESCRIPCIONARTICULO, articuloLinea.getArticulo().getDsdescripcion());
            setAttribute(ArticuloLineaDS.DURACION, articuloLinea.getArticulo().getNmduracion());
        } else {
            setAttribute(ArticuloLineaDS.CODIGOARTICULO, "");
            setAttribute(ArticuloLineaDS.DESCRIPCIONARTICULO, "");
            setAttribute(ArticuloLineaDS.DURACION, "");
        }

        setAttribute("articuloLinea", articuloLinea);
    }

    public static ListGridField[] getFields() {
        return new ListGridField[]{new ListGridField(ArticuloLineaDS.CODIGOARTICULO, "Código del Articulo"), new ListGridField(ArticuloLineaDS.DESCRIPCIONARTICULO, "Descripción del Articulo"), new ListGridField(ArticuloLineaDS.DURACION, "Duración")};
    }
}
